<!DOCTYPE html>

<html class="no-js">

<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <title></title>
  <meta name="description" content="" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />

  <script src="https://cdn.staticfile.org/axios/0.19.0-beta.1/axios.js"></script>

  <script src="../../cdn/vue/vue.global.min.js"></script>
  <!-- 导入表格需要的包 -->

  <script src="https://cdn.staticfile.org/FileSaver.js/2014-11-29/FileSaver.min.js"></script>
  <script src="https://cdn.staticfile.org/xlsx/0.18.2/xlsx.full.min.js"></script>
  <link rel="stylesheet" href="../../cdn/element-plus/index.css" />
  <script src="../../cdn/element-plus/index.full.min.js"></script>
  <link rel="stylesheet" href="../../../lib/index.css" />
  <script src="../../../lib/avue.js"></script>
  <style>
    .imgbox {
      position: absolute;
      width: 80px;
      right: 20px;
      bottom: 60px;
    }

    .imgbox img {
      width: 100%;
    }

    .imgbox .avue-crud__grid__label {
      display: none;
    }
  </style>
</head>

<body>
  <div id="app">
    {{form}}
    <avue-crud v-model="form" ref="crud" :data="data" :option="option">
      <template #img="{row}">
        <img :src="row.img" alt="">
      </template>
    </avue-crud>
  </div>
</body>
<script>
  let app = Vue.createApp({
    data () {
      return {
        form: {},
        data: [
          {
            name: '张三',
            sex: '男',
            grade: 1,
            img: 'https://avuejs.com/images/logo.png',
            address: '110000',
            cascader: [3, 1],
            checkbox: [0, 1],
            tree: 0,
          }, {
            name: '李四',
            sex: '女',
            grade: 0,
            img: 'https://avuejs.com/images/logo.png',
            address: '120000',
            cascader: [3, 2],
            checkbox: [0, 1],
            tree: 1
          }
        ],
        option: {
          grid: true,
          page: false,
          align: 'center',
          menuAlign: 'center',
          viewBtn: true,
          selection: true,
          menuAlign: 'left',
          column: [
            {
              label: '姓名',
              prop: 'name',
              row: true
            }, {
              label: '性别',
              prop: 'sex',
              gridRow: true
            }, {
              label: '姓名',
              prop: 'address',
              gridRow: true
            }, {
              label: '性别',
              prop: 'sex',
              gridRow: true
            }, {
              label: '',
              className: "imgbox",
              prop: 'img'
            }, {
              label: '权限',
              prop: 'grade',
              type: 'select',
              gridRow: true,
              dicData: [
                {
                  label: '有权限',
                  value: 1
                }, {
                  label: '无权限',
                  value: 0
                }, {
                  label: '禁止项',
                  disabled: true,
                  value: -1
                }
              ]
            }]
        }
      }
    },
    mounted () {

    }
  })
  app.use(ElementPlus)
  app.use(AVUE)
  app.mount('#app')
</script>

</html>